<?php if (!defined('APPLICATION')) exit();
// Copyright Trademark Productions 2010

$PluginInfo['RKHeaderLink'] = array(
    'Description' => 'A plugin that adds a link to the menu. Hooray!',
    'Version' => '1.0',
    'Author' => 'Håvard Lindset',
    'AuthorEmail' => 'lindset@gmail.com',
    'AuthorUrl' => 'http://craveit.no',
);

class RKHeaderLinkPlugin extends Gdn_Plugin {
   /**
    * Adds back-link to main menu.
    */
   public function Base_Render_Before(&$Sender) {
      $Session = Gdn::Session();
      if ($Sender->Menu && $Session->IsValid()) {
         // Comment out this next line if you want to put the link somewhere else manually
         $Sender->Menu->AddLink('BackToMainPage', T('Back to Main Page'), 'http://trkh.no/', FALSE);
         array_splice($Sender->Menu->Sort, $Location, 0, 'BackToMainPage');
      }
   }
}
